//
//  JPAccount.m
//  JPShop
//
//  Created by 虎爷 on 2019/9/27.
//  Copyright © 2019 虎爷. All rights reserved.
//

#import "JPAccount.h"


#define accountVariableTokenID @"publicVariableUserRequestToken_ID"
#define accountVariableSwitchID @"publicVariableUserRequestSwitch_ID"
#define accountVariableInviteCodeID @"publicVariableUserRequestInviteCode_ID"

@implementation JPAccount
singleton_implementation(JPAccount)

//  从沙河中获取个人信息
-(void)LoadTokenFromSandbox{
    NSUserDefaults *publicVariabledefaults = [NSUserDefaults standardUserDefaults];
    self.token = [publicVariabledefaults objectForKey:accountVariableTokenID];
    [publicVariabledefaults synchronize];
}

-(void)SaveTokenToSandbox{
    NSUserDefaults *publicVariabledefaults = [NSUserDefaults standardUserDefaults];
    [publicVariabledefaults setObject:self.token forKey:accountVariableTokenID];
    [publicVariabledefaults synchronize];
}

-(void)SaveSwitchToSandbox{
    NSUserDefaults *publicVariabledefaults = [NSUserDefaults standardUserDefaults];
    [publicVariabledefaults setObject:self.wx_switch forKey:accountVariableSwitchID];
    [publicVariabledefaults synchronize];
}
-(void)LoadSwitchFromSandbox{
    NSUserDefaults *publicVariabledefaults = [NSUserDefaults standardUserDefaults];
    self.wx_switch = [publicVariabledefaults objectForKey:accountVariableSwitchID];
    [publicVariabledefaults synchronize];
}

-(void)SaveInviteCodeToSandbox{
    NSUserDefaults *publicVariabledefaults = [NSUserDefaults standardUserDefaults];
    [publicVariabledefaults setObject:self.inviteCode forKey:accountVariableInviteCodeID];
    [publicVariabledefaults synchronize];
}

-(void)LoadInviteCodeFromSandbox{
    NSUserDefaults *publicVariabledefaults = [NSUserDefaults standardUserDefaults];
    self.inviteCode = [publicVariabledefaults objectForKey:accountVariableInviteCodeID];
    [publicVariabledefaults synchronize];
}


@end
